﻿package core.ui.controls
{
    import flash.display.*;
    import flash.text.*;

    public class Progressbar extends Sprite
    {
        var size:int;
        var fill:Sprite;
        var percent:Literal;

        public function Progressbar(param1:int)
        {
            this.size = param1;
            this.graphics.beginFill(14935011);
            this.graphics.drawRect(0, 0, param1, 18);
            this.graphics.beginFill(9079434);
            this.graphics.drawRect(0, 0, (param1 - 1), 17);
            this.graphics.beginFill(16777215);
            this.graphics.drawRect(1, 1, param1 - 2, 16);
            this.graphics.beginFill(15724527);
            this.graphics.drawRect(1, 9, param1 - 2, 8);
            this.graphics.endFill();
            this.fill = new Sprite();
            var _loc_2:int = 2;
            this.fill.y = 2;
            this.fill.x = _loc_2;
            this.fill.graphics.beginFill(2467560);
            this.fill.graphics.drawRect(0, 0, 10, 8);
            this.fill.graphics.beginFill(1939158);
            this.fill.graphics.drawRect(0, 8, 10, 7);
            this.fill.graphics.endFill();
            this.fill.width = 0;
            addChild(this.fill);
            this.percent = new Literal("0%");
            this.percent.autoSize = TextFieldAutoSize.RIGHT;
            this.percent.textColor = 7566195;
            this.percent.x = param1 - 25;
            this.percent.y = 20;
            addChild(this.percent);
            return;
        }// end function

        public function Set(RIGHT:Number) : void
        {
            if (RIGHT < 0)
            {
                RIGHT = 0;
            }
            this.percent.text = String(Math.round(RIGHT * 100)) + "%";
            this.fill.width = Math.round((this.size - 3) * RIGHT);
            return;
        }// end function

    }
}
